const initValue = {
  userChannels: [],
  allChannels: [],
  articles: {},
  moreAction: {
    visible: false,
    articleId: '', // 文章id
  },
}
const home = (state = initValue, action) => {
  const { type, payload } = action
  switch (type) {
    case 'home/userChannels':
      return { ...state, userChannels: payload }
    case 'home/allChannels':
      return { ...state, allChannels: payload }
    case 'home/setArticleList':
      return {
        ...state,
        articles: {
          ...state.articles,
          [payload.channelId]: {
            list: payload.list,
            timestamp: payload.timestamp,
          },
        },
      }
    case 'home/setMoreAction':
      return {
        ...state,
        moreAction: payload,
      }
    default:
      return state
  }
}
export default home
